﻿using System.Linq;
using System.Web.Mvc;
using SportsStore.Domain.Abstract;
using SportsStore.Domain.Concrete;

namespace SportsStore.WebUI.Controllers
{
    public class ProductsController : Controller
    {

        private readonly IProductsRepository productsRepository;

        public ProductsController()
        {
            // Temporary hard-coded connection string until we set up dependency injection
            string connString = @"Server=.\SQLEXPRESS;Database=SportsStore;Trusted_Connection=yes;";
            productsRepository = new SqlProductsRepository(connString);
        }
        public ViewResult List()
        {
            return View(productsRepository.Products.ToList());
        }

    }
}
